Many system busses are cache line-oriented and do not support memory requests beginning at arbitrary byte locations. Each memory request fetches an entire cache line by addressing the first byte of the line. Packets transmitted on a network, however, include a payload of data which can begin at any arbitrary byte address. Thus, if the packet payload is to begin with a byte of data in the middle of a cache line, extra complexity is involved in building a packet. When data is returned from memory as a line, the network adapter needs to be instructed to copy only the desired data into a temporary buffer which we call herein a packet buffer. A packet buffer is organized with lines of data beginning at the first byte of the packet payload which is not necessarily the first byte of a cache line. When the logic unit that makes the memory request is different from the logic unit that controls the packet buffer, it is typically necessary to first communicate an indication of the difference between the first byte of the packet payload and the first byte of a cache line. Thereafter, memory requests can be made and the packet buffer can be properly loaded.
Lines of data are stored in memory. When building a packet payload, a memory access system determines a shift value that corresponds to any misalignment between the first byte in a line of data in memory and the first byte in the data desired for the packet payload. In accordance with an embodiment of the invention, the shift value is incorporated into a tag which is part of a read request for data from memory. A packet buffer control system receives a line of data from memory responsive to the read request. The response from memory also conveniently includes the tag with the shift value. The packet buffer controller shifts the received line of data for storage in a packet buffer in accordance with the shift value.
In accordance with an embodiment of a method of loading a first line of data into a packet buffer, the first line of data is received along with a tag indicating a shift value (N). At least those bytes of data following the first N bytes of data are written into the packet buffer, where N equals the shift value. A mask is set up to prevent overwriting those bytes of data that followed the first N bytes in the line of data.
In accordance with an embodiment of a method for loading a line of data into a packet buffer, preferably a line of data is received from memory along with a tag indicating a shift value. The line of data is shifted in accordance with the shift value in the tag and the shifted line of data is written into the packet buffer. Writing is preferably performed by writing bytes of the shifted line of data that are in unmasked positions of the packet buffer while bytes of the shifted line of data in masked positions of the packet buffer do not make changes to the masked positions of the packet buffer. The shifted line of data is then written into the packet buffer for a second time. A mask is set up for bytes in the packet buffer across the width of the buffer except for the last N bytes where N equals the shift value.
In accordance with embodiments of the present invention, a tag including a shift value is included in a memory request and is passed along to a packet buffer controller in response to the request. It is therefore unnecessary to coordinate a separate communication between the memory request unit and the packet buffer controller to indicate the shift value. The tag may further include a unique identifier so that responses can be put in proper sequence at the packet buffer controller regardless of the order in which the responses are received.
Other objects and advantages of the invention will become apparent during the following description of the presently preferred embodiments of the invention taken in conjunction with the drawings.